]> git.r.bdr.sh - rbdr/captura/blobdiff - Captura/Core Extensions/CVImageBuffer+cgImage.swift
Save WIP -> Multimonitor change working
[rbdr/captura] / Captura / Core Extensions / CVImageBuffer+cgImage.swift
index c30cb0c9433f4858e78d919fed16f8d0ed3d74d1..f8958f22eb5a89ab956abba7c784faf9560ec92f 100644 (file)
@@ -3,9 +3,10 @@ import ReplayKit
 
 extension CVImageBuffer {
   
+  static let sharedContext = CIContext()
+  
   var cgImage: CGImage? {
     let ciImage = CIImage(cvImageBuffer: self)
-    let context = CIContext()
-    return context.createCGImage(ciImage, from: CGRect(x: 0, y: 0, width: CVPixelBufferGetWidth(self), height: CVPixelBufferGetHeight(self)))
+    return CVImageBuffer.sharedContext.createCGImage(ciImage, from: CGRect(x: 0, y: 0, width: CVPixelBufferGetWidth(self), height: CVPixelBufferGetHeight(self)))
   }
 }